#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1010;

int t,u,a[MAXN],ans;

int main (){
	scanf("%d",&t);
	while(t--){
		scanf("%d",&u);ans = 0;
		for(int i = 1;i <= u;i++) scanf("%d",&a[i]);
		for(int i = u;i >= 1;i--) if((i & 1)==(u & 1)) ans ^= a[i] - a[i-1];
		puts(ans ? "TAK" : "NIE");
	}return 0;
}
